package raf;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * 文件复制
 * @author 范传奇
 *
 */
public class CopyDemo {
	public static void main(String[] args) throws IOException {
		RandomAccessFile src = new RandomAccessFile("./movie.mkv","r");

		RandomAccessFile desc = new RandomAccessFile("./movie_cp.mkv","rw");
		
		int d = 0;//用来记录每次读取到的字节
		long start = System.currentTimeMillis();
		while( (d = src.read()) != -1  ) {
			desc.write(d);
		}
		long end = System.currentTimeMillis();
		System.out.println("复制完毕!耗时:"+(end-start)+"ms");
		src.close();
		desc.close();
	}
}






